Information for System Administrators: Scheduled Exports
The emuexport command is the program used to execute scheduled exports. It interacts with the Schedules and Exports modules to ensure that data exports occur when scheduled. The emuexport command must be run in order for Scheduled Exports to occur.
The emuexport command is typically run early each morning. The server based cron facility provides this ability. The following crontab entry is required:
0 1 * * * ~emu/bin/emurun emuexport 2>&1 | ~emu/bin/emurun emulogger -t "KE EMu Scheduled Exports Report" exports
where ~emu is replaced with the full path to where EMu is installed on the server machine.
The time at which the command is run (1:00 am in the example above) should be adjusted to fit in with any EMu maintenance scheduled.
The emuexport program can be used in the following ways:
- Run all scheduled exports
Usage: emuexport
Any scheduled exports required to be run will be executed. The current date is used to determine what exports are required. This form of the command is used by cron on a daily basis to ensure all scheduled exports for the given day are performed.
- Exclude one or more scheduled exports from the default run of scheduled exports
Usage: emuexport -xirn[,irn,..] (where irn is the IRN of a scheduled export specified in the Schedules module).
The default emuexport command runs all scheduled exports at the same time. The -x irn parameter is used to exclude one or more scheduled exports from this default run of scheduled exports (in order to run any excluded scheduled exports at another time).
- Run an unscheduled export
Usage: emuexport -f filename -g recordcount -i irn
The filename argument is the path to a file containing the export data in EMu XML format. A suitable file can be generated using the EMu reporting facility and selecting a Report Type of Export XML Document. The recordcount is the number of records in the XML file and irn is the IRN of the Schedules record to execute. An Unscheduled Export run within EMu uses this form of emuexport.
- Run scheduled exports for a specific date
Usage:
emuexport -R date [-i irn]
The date argument indicates the date to use to determine what Scheduled Exports need to be run. The date format expected is yyyy/mm/dd. An optional IRN of a Schedules record may be supplied to force a particular Scheduled Export to execute using the supplied date. This form of emuexport is useful for re-running Scheduled Exports for a given date, generally because of problems with the nightly automatic run. It can also be used for internal testing of emuexport.
- Run a specific scheduled export
Usage:
emuexport -i irn [-s startdate -e enddate]
The irn argument is the IRN of a Schedules record to be executed. Optional startdate and enddate values (in yyyy/mm/dd format) may be used to override the computed #STARTDATE# and #ENDDATE# values respectively. This form of emuexport is very useful for testing filters as it allows a specific schedule to be run without waiting for the Scheduled Export date to arrive.
In all usages of emuexport the appropriate Exports record is created for each export executed.